package com.minimalist.common.entity.basic.vo.dict;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.config.swagger.SchemaEnum;
import com.minimalist.common.entity.basic.enums.StatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author 11987
 */
@Schema(name = "字典数据实体")
public class DictDataVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "dictId", description = "字典ID", type = "string")
    private Long dictId;

    @NotBlank(message = "字典key不能为空")
    @Schema(name = "dictKey", description = "字典key", type = "string")
    private String dictKey;

    @NotBlank(message = "字典value不能为空")
    @Schema(name = "dictValue", description = "字典value", type = "string")
    private String dictValue;

    @NotNull(message = "字典排序值不能为空")
    @Schema(name = "dictOrder", description = "字典排序值", type = "integer")
    private Integer dictOrder;

    @Schema(name = "dictClass", description = "字典样式，对应前端Tag组件的type", type = "string")
    private String dictClass;

    @SchemaEnum(implementation = StatusEnum.class)
    @Schema(name = "status", description = "字典状态", type = "integer")
    private Integer status;

    public Long getDictId() {
        return dictId;
    }

    public void setDictId(Long dictId) {
        this.dictId = dictId;
    }

    public String getDictKey() {
        return dictKey;
    }

    public void setDictKey(String dictKey) {
        this.dictKey = dictKey;
    }

    public String getDictValue() {
        return dictValue;
    }

    public void setDictValue(String dictValue) {
        this.dictValue = dictValue;
    }

    public Integer getDictOrder() {
        return dictOrder;
    }

    public void setDictOrder(Integer dictOrder) {
        this.dictOrder = dictOrder;
    }

    public String getDictClass() {
        return dictClass;
    }

    public void setDictClass(String dictClass) {
        this.dictClass = dictClass;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DictDataVO that = (DictDataVO) o;
        return java.util.Objects.equals(dictId, that.dictId) &&
               java.util.Objects.equals(dictKey, that.dictKey) &&
               java.util.Objects.equals(dictValue, that.dictValue) &&
               java.util.Objects.equals(dictOrder, that.dictOrder) &&
               java.util.Objects.equals(dictClass, that.dictClass) &&
               java.util.Objects.equals(status, that.status);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(dictId, dictKey, dictValue, dictOrder, dictClass, status);
    }

    @Override
    public String toString() {
        return "DictDataVO{" +
               "dictId=" + dictId +
               ", dictKey='" + dictKey + '\'' +
               ", dictValue='" + dictValue + '\'' +
               ", dictOrder=" + dictOrder +
               ", dictClass='" + dictClass + '\'' +
               ", status=" + status +
               '}';
    }

}
